package com.codefactory.aps.classes;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Setup extends javax.swing.JFrame {

    public Setup() {
        initComponents();
        onCreate();
    }
    
    private void onCreate(){
        
        this.setLocationRelativeTo(null);
        
        LogManager.log("Opened 'Setup' Frame.");
        
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Setup");
        setName("setup"); // NOI18N
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        
        ExitManager.showExitPrompt();
        
    }//GEN-LAST:event_formWindowClosing

    public static void createWindow() {
        
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException ex) {
            LogManager.log("Class: Setup, Method: createWindow(), Exception: ClassNotFoundException, '" + ex.getMessage() + "'");
        } catch (InstantiationException ex) {
            LogManager.log("Class: Setup, Method: createWindow(), Exception: InstantiationException, '" + ex.getMessage() + "'");
        } catch (IllegalAccessException ex) {
            LogManager.log("Class: Setup, Method: createWindow(), Exception: IllegalAccessException, '" + ex.getMessage() + "'");
        } catch (UnsupportedLookAndFeelException ex) {
            LogManager.log("Class: Setup, Method: createWindow(), Exception: UnsupportedLookAndFeelException, '" + ex.getMessage() + "'");
        }
        
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Setup().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
